home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-02-28 | 5.8 KB | 215 lines | [TEXT/MPS ] |
-
- // ---- End Project Data ----
-
-
- // ---- File DatePick.t ----
-
- // Before Script for "monthPickerExample"
- //Copyright 1993-1994 Apple Computer, Inc.
-
- monthPickerExample :=
- {title: "clMonthView Sample",
- viewBounds: {top: 0, left: 0, right: 240, bottom: 335},
- viewFlags: 516,
- selectedDates: [],
- viewSetupFormScript:
- func()
- begin
- local b := GetAppParams();
- constant kMaxWidth := 240;
- constant kMaxHeight := 336;
-
- viewBounds := RelBounds(b.appAreaLeft, b.appAreaTop,
- Min(b.appAreaWidth, kMaxWidth),
- Min(b.appAreaHeight, kMaxHeight) );
-
-
- selectedDates := [Time()];
-
- end,
- _proto: protoApp,
- debug: "monthPickerExample"
- };
-
-
- // ---- File protoDatePicker ----
-
- // Before Script for "protoDatePicker"
- // Copyright 1993-1994 Apple Computer, Inc.
-
- protoDatePicker :=
- {viewFlags: 1,
- viewFormat: nil,
- viewBounds: {left: 0, top: 0, right: 120, bottom: 100},
- monthChangedScript:
- func()
- begin
- // This will be inherited by the child month view and called every time
- // the user taps on a new day. It *must* be here because the user can
- // tap on days at the end or beginning of the previous or next month
- // (the blank spaces on the view) and actually change the date!
- // If this script isn't here to update the view and the title string,
- // the month with change but the display won't--confusing the heck out of
- // people.
- :Dirty();
- :SetTitle();
- end,
- monthYearSpec:
- GetDateStringSpec([
- [kElementMonth, kFormatLong],
- [kElementYear, kFormatLong]]),
- SetTitle:
- // This function updates the month/year label. It should be called
- // whenever the user changes the date.
-
- func()
- begin
- SetValue(monthYearLabel, 'text,
- LongDateStr(selectedDates[0], monthYearSpec));
- end,
- viewSetupDoneScript:
- func()
- begin
- if NOT selectedDates exists then
- self.selectedDates := [Time()]; // initialize selectedDates to current
- :SetTitle();
- end,
- Refresh:
- // This allows scripts outside the proto to have a nice entry point for
- // getting the picker refreshed when the selectedDates array changes.
-
- func()
- begin
- monthView:Dirty();
- :SetTitle();
- end,
- viewclass: 74,
- debug: "protoDatePicker"
- };
-
- monthYearLabel := /* child of protoDatePicker */
- {text: "",
- viewBounds: {left: 0, top: 0, right: 0, bottom: 15},
- viewFlags: 3,
- viewJustify: 8388662,
- _proto: protoStaticText,
- debug: "monthYearLabel"
- };
- // View monthYearLabel is declared to protoDatePicker
-
-
-
- previousMonthButton := /* child of protoDatePicker */
- {viewBounds: {left: 0, top: 0, right: 15, bottom: 15},
- viewSetupFormScript:
- func()
- begin
- // initialize the icon from the system bitmap via a magic pointer.
- self.icon := @325; // leftBitmap
- end,
- viewFlags: 515,
- viewJustify: 6,
- viewFormat: 1,
- buttonPressedScript:
- func()
- begin
- // move to the previous month, and make sure the views redraw.
- selectedDates[0] := IncrementMonth(selectedDates[0], -1);
- monthView:dirty();
- :SetTitle();
-
- // have to call RefreshViews because this is the buttonPressedScript,
- // the view otherwise wouldn't get refreshed until the user lifted the
- // pen! If you had done this in the buttonClickScript instead, you
- // could skip the RefreshViews() call.
- RefreshViews();
- end,
- icon: nil,
- _proto: protoPictureButton,
- debug: "previousMonthButton"
- };
-
-
-
- nextMonthButton := /* child of protoDatePicker */
- {icon: nil,
- viewBounds: {top: 0, left: -15, right: 0, bottom: 15},
- viewSetupFormScript:
- func()
- begin
- // initialize the bitmap from the system ROMs via a magic pointer.
-
- self.icon := @326; // rightBitmap
- end,
- viewFlags: 515,
- viewFormat: 1,
- viewJustify: 38,
- buttonPressedScript:
- func()
- begin
- // move to the previous month, and make sure the views redraw.
- selectedDates[0] := IncrementMonth(selectedDates[0], 1);
- monthView:dirty();
- :SetTitle();
-
- // have to call RefreshViews because this is the buttonPressedScript,
- // the view otherwise wouldn't get refreshed until the user lifted the
- // pen! If you had done this in the buttonClickScript instead, you
- // could skip the RefreshViews() call.
- RefreshViews();
- end,
- Copyright: "Copyright 1993-1994 Apple Computer, Inc.",
- _proto: protoPictureButton,
- debug: "nextMonthButton"
- };
-
-
-
- monthView := /* child of protoDatePicker */
- {viewBounds: {top: 15, left: 1, right: -1, bottom: -1},
- viewFlags: 513,
- viewFormat: nil,
- labelFont: ROM_fontSystem9Bold,
- dateFont: ROM_fontSystem9,
- viewJustify: 246,
- singleDay: true,
- viewclass: 80,
- debug: "monthView"
- };
- // View monthView is declared to protoDatePicker
-
-
-
-
- // ---- Back in File DatePick.t ----
- datePicker := /* child of monthPickerExample */
- {viewBounds: {left: 41, top: 25, right: 161, bottom: 113},
- viewFormat: 336,
- _proto: protoDatePicker,
- debug: "datePicker"
- };
- // View datePicker is declared to monthPickerExample
-
-
-
- _view000 := /* child of monthPickerExample */
- {text: "Today",
- buttonClickScript:
- func()
- begin
- selectedDates := [Time()]; // get current date/time
- datePicker:Refresh();
- end,
- viewBounds: {left: 44, top: 124, right: 160, bottom: 144},
- _proto: protoTextButton
- };
-
-
-
-
-
-
-
- // ---- Beginning of section for non used Layout files ----
-
- // End of output